<template>
  <a-spin :spinning="confirmLoading">
    <a-button @click="ShowTable" type="primary" icon="plus">显示主表单</a-button>
    <j-form-container :disabled="formDisabled">
      <!-- 主表单区域 -->
      <a-form-model ref="form" v-show="isshow" :model="model" :rules="validatorRules" slot="detail">
        <a-row>
          <a-col :span="24" >
            <h2>项目基本信息</h2>
          </a-col>
          <!-- <a-col :span="6" >
            <a-form-model-item label="年份" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaYear">
              <a-input v-model="model.oaYear" placeholder="请输入年份" ></a-input>
            </a-form-model-item>
          </a-col> -->
          <a-col :span="6" >
            <a-form-model-item label="客户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaCustomerName">
              <j-search-select-tag
                v-model="model.oaCustomerName"
                dict="oa_customerName"
                placeholder="请输入客户名称"
              />
              
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="6" >
            <a-form-model-item label="客户编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaCustomerNum">
              <a-input v-model="model.oaCustomerNum" placeholder="请输入客户编号" ></a-input>
            </a-form-model-item>
          </a-col> -->
          <a-col :span="6" >
            <a-form-model-item label="钳工担当" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaFitterResponsible">
              <j-search-select-tag
                v-model="model.oaFitterResponsible"
                dict="oa_fitterResponsible"
                placeholder="请输入钳工担当"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="项目担当" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaProjectResponsible">
              <j-search-select-tag
                v-model="model.oaProjectResponsible"
                dict="oa_projectResponsible"
                placeholder="请输入项目担当"
              />
        
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="CHT模号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaCht">
              <a-input v-model="model.oaCht" placeholder="请输入CHT模号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <h2>产品信息</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaProductNumber">
              <a-input v-model="model.oaProductNumber" placeholder="请输入产品编号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaProductName">
              <a-input v-model="model.oaProductName" placeholder="请输入产品名称" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品材料T100编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaT100Number">
              <a-input v-model="model.oaT100Number" placeholder="请输入产品材料T100编号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品外型尺寸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaProductSize">
              <a-input v-model="model.oaProductSize" placeholder="请输入产品外型尺寸" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="外观要求" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaAppearanceRequirements">
              <j-search-select-tag
                v-model="model.oaAppearanceRequirements"
                dict="oa_appearanceRequirements"
                placeholder="请输入外观要求"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="嵌件有无" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaInsertsPresent">
              <j-search-select-tag
                v-model="model.oaInsertsPresent"
                dict="oa_insertsPresent"
                placeholder="请输入嵌件有无"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="嵌入方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaEmbedMode">
              <j-search-select-tag
                v-model="model.oaEmbedMode"
                dict="oa_embedMode"
                placeholder="请输入嵌入方式"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="喷油" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaFuelInjection">
              <j-search-select-tag
                v-model="model.oaFuelInjection"
                dict="oa_fuelInjection"
                placeholder="请输入喷油"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="丝印" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaSilkscreen">
              <j-search-select-tag
                v-model="model.oaSilkscreen"
                dict="oa_silkscreen"
                placeholder="请输入丝印"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="电镀" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaElectroplating">
              <a-input v-model="model.oaElectroplating" placeholder="请输入电镀" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="省模等级" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaProvinceModelLevel">
              <a-input v-model="model.oaProvinceModelLevel" placeholder="请输入省模等级" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaRemark">
              <j-search-select-tag
                v-model="model.oaRemark"
                dict="oa_remark"
                placeholder="请输入备注"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pic">
              <j-image-upload isMultiple  v-model="model.pic" ></j-image-upload>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <h2>模具信息</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="客户模具管理编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaMoldManagementNumber">
              <a-input v-model="model.oaMoldManagementNumber" placeholder="请输入客户模具管理编号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具尺寸(宽高厚)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaMoldSize">
              <a-input v-model="model.oaMoldSize" placeholder="请输入模具尺寸(宽高厚)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具结构" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaMoldStructure">
              <j-search-select-tag
                v-model="model.oaMoldStructure"
                dict="oa_moldStructure"
                placeholder="请输入模具结构"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="流道方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaFlowChannelMode">
              <j-search-select-tag
                v-model="model.oaFlowChannelMode"
                dict="oa_flowChannelMode"
                placeholder="请输入流道方式"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="进胶方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaGlueFeedingMode">
              <j-search-select-tag
                v-model="model.oaGlueFeedingMode"
                dict="oa_glueFeedingMode"
                placeholder="请输入进胶方式"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="进胶点数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaFeedingPoints">
              <j-search-select-tag
                v-model="model.oaFeedingPoints"
                dict="oa_feedingPoints"
                placeholder="请输入进胶点数"
              />
              
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="6" >
            <a-form-model-item label="模仁材质" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaMoldMaterial">
              <a-input v-model="model.oaMoldMaterial" placeholder="请输入模仁材质" ></a-input>
            </a-form-model-item>
          </a-col> -->
          <a-col :span="6" >
            <a-form-model-item label="前模" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaBeforeMold">
              <a-input v-model="model.oaBeforeMold" placeholder="请输入前模" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="后模" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaAfterMold">
              <a-input v-model="model.oaAfterMold" placeholder="请输入后模" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="行位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaSlide">
              <a-input v-model="model.oaSlide" placeholder="请输入行位" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具穴数(取数)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaCavityNumbe">
              <j-search-select-tag
                v-model="model.oaCavityNumbe"
                dict="oa_cavityNumbe"
                placeholder="请输入模具穴数(取数)"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="蚀纹有无" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaEtching">
              <j-search-select-tag
                v-model="model.oaEtching"
                dict="oa_etching"
                placeholder="请输入蚀纹有无"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="纹号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaGrainNumber">
              <a-input v-model="model.oaGrainNumber" placeholder="请输入纹号" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="缩水率" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaShrinkage">
              <a-input v-model="model.oaShrinkage" placeholder="请输入缩水率" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具难度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaMoldDifficulty">
              <j-search-select-tag
                v-model="model.oaMoldDifficulty"
                dict="oa_moldDifficulty"
                placeholder="请输入模具难度"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具寿命" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaDieLife">
              <j-search-select-tag
                v-model="model.oaDieLife"
                dict="oa_dieLife"
                placeholder="请输入模具寿命"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="顶出方案" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaEjectorScheme">
              <j-search-select-tag
                v-model="model.oaEjectorScheme"
                dict="oa_ejectorScheme"
                placeholder="请输入顶出方案"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="热流道品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaHotRunnerBrand">
              <j-search-select-tag
                v-model="model.oaHotRunnerBrand"
                dict="oa_hotRunnerBrand"
                placeholder="请输入热流道品牌"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模胚材质" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaMouldMaterial">
              <j-search-select-tag
                v-model="model.oaMouldMaterial"
                dict="oa_mouldMaterial"
                placeholder="请输入模胚材质"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="模具种类" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="oaMoldType">
              <j-search-select-tag
                v-model="model.oaMoldType"
                dict="oa_moldType"
                placeholder="请输入模具种类"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="24" >
            <h2>注塑成型信息</h2>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型周期(报价)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldingCycleQuotation">
              <a-input v-model="model.moldingCycleQuotation" placeholder="请输入成型周期(报价)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型吨位(报价)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="formingTonnageQuotation">
              <j-search-select-tag
                v-model="model.formingTonnageQuotation"
                dict="oa_formingTonnage"
                placeholder="请输入成型吨位(报价)"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品单重(报价)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productWeightQuotation">
              <a-input v-model="model.productWeightQuotation" placeholder="请输入产品单重(报价)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="水口单重(报价)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shuikouUnitWeightQuotation">
              <a-input v-model="model.shuikouUnitWeightQuotation" placeholder="请输入水口单重(报价)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型周期(目标)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldingCycleAim">
              <a-input v-model="model.moldingCycleAim" placeholder="请输入成型周期(目标)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型吨位(目标)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="formingTonnageAim">
              <a-input v-model="model.formingTonnageAim" placeholder="请输入成型吨位(目标)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品单重(目标)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productWeightAim">
              <a-input v-model="model.productWeightAim" placeholder="请输入产品单重(目标)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="水口单重(目标)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shuikouUnitWeightAim">
              <a-input v-model="model.shuikouUnitWeightAim" placeholder="请输入水口单重(目标)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型周期(实际)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moldingCycleActual">
              <a-input v-model="model.moldingCycleActual" placeholder="请输入成型周期(实际)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="成型吨位(实际)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="formingTonnageActual">
              <j-search-select-tag
                v-model="model.formingTonnageActual"
                dict="oa_formingTonnage"
                placeholder="请输入成型吨位(实际)"
              />
              
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="产品单重(实际)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productWeightActual">
              <a-input v-model="model.productWeightActual" placeholder="请输入产品单重(实际)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6" >
            <a-form-model-item label="水口单重(实际)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="shuikouUnitWeightActual">
              <a-input v-model="model.shuikouUnitWeightActual" placeholder="请输入水口单重(实际)" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="8" >
            <a-form-model-item label="特别注意的成型事项" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="precautions">
              <j-search-select-tag
                v-model="model.precautions"
                dict="oa_precautions"
                placeholder="请输入特别注意的成型事项"
              />
              
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </j-form-container>
      <!-- 子表单区域 -->
    <a-tabs v-model="activeKey" @change="handleChangeTabs">
      <a-tab-pane tab="OA_DFM完成时间" :key="refKeys[0]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[0]"
          :loading="oaDfmCompletionTimeTable.loading"
          :columns="oaDfmCompletionTimeTable.columns"
          :dataSource="oaDfmCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="OA模流完成时间" :key="refKeys[1]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[1]"
          :loading="oaMoldflowCompletionTimeTable.loading"
          :columns="oaMoldflowCompletionTimeTable.columns"
          :dataSource="oaMoldflowCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="OA模具设计完成时间" :key="refKeys[2]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[2]"
          :loading="oaMoldDesignCompletionTimeTable.loading"
          :columns="oaMoldDesignCompletionTimeTable.columns"
          :dataSource="oaMoldDesignCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="OA订购时间" :key="refKeys[5]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[5]"
          :loading="oaOrderTimeTable.loading"
          :columns="oaOrderTimeTable.columns"
          :dataSource="oaOrderTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true">

<!-- 
          <template v-slot:plan="props">
            <a-date-picker format="YYYY-MM-DD"   @change="onChange"/>
            <j-date placeholder="请选择FAI要求时间"  v-model="model.fairequireTime" date-format="YYYY-MM-DD" style="width: 100%" />
            <a-input :value="props.text" disabled />
          </template>
          <template v-slot:actual="props">
            <a-date-picker format="YYYY-MM-DD" v-model="bbb"  @change="date_diffChange(props.getValue())"/>
            <a-input :value="props.text" disabled />
          </template> 
          -->
          <!-- <template v-slot:difference="props">
            <a-input :value="props.text" disabled />
          </template> -->
        </j-editable-table>
      </a-tab-pane>
      <a-tab-pane tab="OA模具加工完成时间" :key="refKeys[3]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[3]"
          :loading="oaMoldProcessingCompletionTimeTable.loading"
          :columns="oaMoldProcessingCompletionTimeTable.columns"
          :dataSource="oaMoldProcessingCompletionTimeTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="OA项目目标管理" :key="refKeys[4]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[4]"
          :loading="oaProjectObjectiveManagementTable.loading"
          :columns="oaProjectObjectiveManagementTable.columns"
          :dataSource="oaProjectObjectiveManagementTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="OA试模修模管理" :key="refKeys[6]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[6]"
          :loading="oaMoldTestAndRepairManagementTable.loading"
          :columns="oaMoldTestAndRepairManagementTable.columns"
          :dataSource="oaMoldTestAndRepairManagementTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="OA项目变更管理" :key="refKeys[7]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[7]"
          :loading="oaProjectChangeManagementTable.loading"
          :columns="oaProjectChangeManagementTable.columns"
          :dataSource="oaProjectChangeManagementTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      <a-tab-pane tab="OA项目验收管理" :key="refKeys[8]" :forceRender="true">
        <j-editable-table
          :ref="refKeys[8]"
          :loading="oaProjectAcceptanceManagementTable.loading"
          :columns="oaProjectAcceptanceManagementTable.columns"
          :dataSource="oaProjectAcceptanceManagementTable.dataSource"
          :maxHeight="300"
          :disabled="formDisabled"
          :rowNumber="true"
          :rowSelection="true"
          :actionButton="true"/>
      </a-tab-pane>
      
    </a-tabs>
  </a-spin>
</template>

<script>

  import { getAction } from '@/api/manage'
  import { FormTypes,getRefPromise,VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
  import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
  import { validateDuplicateValue } from '@/utils/util'

  export default {
    name: 'OaProjectProgressTableForm',
    mixins: [JEditableTableModelMixin],
    
    components: {
    },
    data() {
      return {
        labelCol: {
          xs: { span: 24 },
          sm: { span: 11 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 13 },
        },
        isshow:false,
        model:{
        },
        aaa:'',
        bbb:'',
        // 新增时子表默认添加几行空数据
        addDefaultRowNum: 1,
        validatorRules: {
        },
        refKeys: ['oaDfmCompletionTime', 'oaMoldflowCompletionTime', 'oaMoldDesignCompletionTime', 'oaMoldProcessingCompletionTime', 'oaProjectObjectiveManagement', 'oaOrderTime', 'oaMoldTestAndRepairManagement', 'oaProjectChangeManagement', 'oaProjectAcceptanceManagement', ],
        tableKeys:['oaDfmCompletionTime', 'oaMoldflowCompletionTime', 'oaMoldDesignCompletionTime', 'oaMoldProcessingCompletionTime', 'oaProjectObjectiveManagement', 'oaOrderTime', 'oaMoldTestAndRepairManagement', 'oaProjectChangeManagement', 'oaProjectAcceptanceManagement', ],
        activeKey: 'oaDfmCompletionTime',
        // OA_DFM完成时间
        oaDfmCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              dictCode:'oa_dfmtime',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '项目发出时间',
              key: 'projectIssueTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户回复时间',
              key: 'customerReplyTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA模流完成时间
        oaMoldflowCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              dictCode:'oa_dfmtime',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '项目发出时间',
              key: 'projectIssueTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户回复时间',
              key: 'customerReplyTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA模具设计完成时间
        oaMoldDesignCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              dictCode: 'oa_moldDesignCompletionTime',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '设计检讨时间',
              key: 'designReviewTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划完成时间',
              key: 'plannedCompletionTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际完成时间',
              key: 'actualCompletionTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '时间差值',
              key: 'timeDifference',
              type: FormTypes.input,
              disabled : true,
              width:"200px",
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '项目发出时间',
              key: 'projectIssueTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户回复时间',
              key: 'customerReplyTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA模具加工完成时间
        oaMoldProcessingCompletionTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              dictCode: 'oa_moldProcessingCompletionTime',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划完成时间',
              key: 'plannedCompletionTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际完成时间',
              key: 'actualCompletionTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '时间差值',
              key: 'timeDifference',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA项目目标管理
        oaProjectObjectiveManagementTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '试模次数(计划)',
              key: 'moldTestNumPlan',
              type: FormTypes.select,
              width:"200px",
              dictCode:'oa_moldTestNum',
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '试模次数(实际)',
              key: 'moldTestNumActual',
              type: FormTypes.select,
              width:"200px",
              dictCode:'oa_moldTestNum',
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户判定',
              key: 'customerDetermination',
              type: FormTypes.select,
              dictCode:'oa_customerDetermination',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '现状说明',
              key: 'statusStatement',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '待办事项',
              key: 'todo',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '困难点',
              key: 'difficultPoint',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '备注',
              key: 'remark',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA订购时间
        oaOrderTimeTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '时间类型',
              key: 'timeType',
              type: FormTypes.select,
              dictCode: 'oa_order_time',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划',
              key: 'plan',
              type: FormTypes.date,
              width:"200px",
              // slotName:'plan',
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际',
              key: 'actual',
              type: FormTypes.date,
              // slotName:'actual',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '差值',
              key: 'difference',
              type: FormTypes.input,
              // slotName:'difference',
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA试模修模管理
        oaMoldTestAndRepairManagementTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '项目id',
              key: 'projectId',
              type: FormTypes.hidden,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '试模次数',
              key: 'moleTestNum',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '模具组装完成(计划)',
              key: 'moldAssembledPlan',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '模具组装完成(实际)',
              key: 'moldAssembledActual',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '模具组装完成(差值)',
              key: 'moldAssembledDifference',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '试模(计划)',
              key: 'moldTestPlan',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '试模(实际)',
              key: 'moldTestActual',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '试模(差值)',
              key: 'moldTestDifference',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '测量(计划)',
              key: 'measurePlan',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '测量(实际)',
              key: 'measureActual',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '测量(差值)',
              key: 'measureDifference',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '提型检(计划)',
              key: 'typeInspectionPlan',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '提型检(实际)',
              key: 'typeInspectionActual',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '提型检(差值)',
              key: 'typeInspectionDifference',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '型检回答(计划)',
              key: 'typeTestAnswerPlan',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '型检回答(实际)',
              key: 'typeTestAnswerActual',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '型检回答(差值)',
              key: 'typeTestDifference',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: 'FA提交天数',
              key: 'faSubmitDays',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '状况',
              key: 'oaCondition',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA项目变更管理
        oaProjectChangeManagementTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '变更次数',
              key: 'editNum',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户通知',
              key: 'customerNotification',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客户承认',
              key: 'customerAcknowledges',
              type: FormTypes.select,
              dictCode: 'oa_customerAcknowledges',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划模具对应完成',
              key: 'plannedMold',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '试作',
              key: 'tryToMake',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '送样',
              key: 'sendSample',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '承认',
              key: 'admit',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
          ]
        },
        // OA项目验收管理
        oaProjectAcceptanceManagementTable: {
          loading: false,
          dataSource: [],
          columns: [
            {
              title: '内部预定合格时间',
              key: 'inPlanQualifiedTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '延期天数',
              key: 'daysOfDeferral',
              type: FormTypes.input,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '调整合格时间',
              key: 'adjustQualifiedTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '内部实际合格时间',
              key: 'inActualQualifiedTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '客判合格目标',
              key: 'customerJudgeQualifiedTarget',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: 'PPAP计划送出时间',
              key: 'ppapPlan',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: 'PPAP实际送出时间',
              key: 'ppapActual',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: 'PPAP时间差值',
              key: 'ppapDifference',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '已送PPAP天数',
              key: 'aapaTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: 'FA回复时间',
              key: 'faReplyTime',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '结果',
              key: 'result',
              type: FormTypes.select,
              dictCode:'oa_result',
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '计划移交生产',
              key: 'planHandoverProduction',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '实际移交生产',
              key: 'actualHandoverToProduction',
              type: FormTypes.date,
              width:"200px",
              placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '移交生产差值',
              key: 'diffHandoverToProduction',
              type: FormTypes.input,
              width:"200px",
              disabled : true,
              // placeholder: '请输入${title}',
              defaultValue:'',
            },
            {
              title: '是否',
              key: 'oa_yno',
              type: FormTypes.select,
              width:"200px",
              placeholder: '请输入${title}',
              dictCode:'oa_yno',
              defaultValue:'',
            },
          ]
        },
        url: {
          add: "/ch/oaProjectProgressTable/add",
          edit: "/ch/oaProjectProgressTable/edit",
          queryById: "/ch/oaProjectProgressTable/queryById",
          oaDfmCompletionTime: {
            list: '/ch/oaProjectProgressTable/queryOaDfmCompletionTimeByMainId'
          },
          oaMoldflowCompletionTime: {
            list: '/ch/oaProjectProgressTable/queryOaMoldflowCompletionTimeByMainId'
          },
          oaMoldDesignCompletionTime: {
            list: '/ch/oaProjectProgressTable/queryOaMoldDesignCompletionTimeByMainId'
          },
          oaMoldProcessingCompletionTime: {
            list: '/ch/oaProjectProgressTable/queryOaMoldProcessingCompletionTimeByMainId'
          },
          oaProjectObjectiveManagement: {
            list: '/ch/oaProjectProgressTable/queryOaProjectObjectiveManagementByMainId'
          },
          oaOrderTime: {
            list: '/ch/oaProjectProgressTable/queryOaOrderTimeByMainId'
          },
          oaMoldTestAndRepairManagement: {
            list: '/ch/oaProjectProgressTable/queryOaMoldTestAndRepairManagementByMainId'
          },
          oaProjectChangeManagement: {
            list: '/ch/oaProjectProgressTable/queryOaProjectChangeManagementByMainId'
          },
          oaProjectAcceptanceManagement: {
            list: '/ch/oaProjectProgressTable/queryOaProjectAcceptanceManagementByMainId'
          },
        }
      }
    },
    props: {
      //表单禁用
      disabled: {
        type: Boolean,
        default: false,
        required: false
      }
    },
    computed: {
      formDisabled(){
        return this.disabled
      },
    },
    created () {
    },
    methods: {
    // onChange(data,dateString){
    //   console.log(dateString)
    // },
    //   date_diffChange(value){
    //     console.log(this.aaa)
    //     console.log(this.bbb)
    //     console.log(this.aaa - this.bbb)
    //     console.log('111111111111111111111111')
    //     console.log(value)
    //   },
    ShowTable(){
      this.isshow = !this.isshow
    },
      addBefore(){
        this.oaDfmCompletionTimeTable.dataSource=[]
        this.oaMoldflowCompletionTimeTable.dataSource=[]
        this.oaMoldDesignCompletionTimeTable.dataSource=[]
        this.oaMoldProcessingCompletionTimeTable.dataSource=[]
        this.oaProjectObjectiveManagementTable.dataSource=[]
        this.oaOrderTimeTable.dataSource=[]
        this.oaMoldTestAndRepairManagementTable.dataSource=[]
        this.oaProjectChangeManagementTable.dataSource=[]
        this.oaProjectAcceptanceManagementTable.dataSource=[]
      },
      getAllTable() {
        let values = this.tableKeys.map(key => getRefPromise(this, key))
        return Promise.all(values)
      },
      /** 调用完edit()方法之后会自动调用此方法 */
      editAfter() {
        this.$nextTick(() => {
        })
        // 加载子表数据
        if (this.model.id) {
          let params = { id: this.model.id }
          this.requestSubTableData(this.url.oaDfmCompletionTime.list, params, this.oaDfmCompletionTimeTable)
          this.requestSubTableData(this.url.oaMoldflowCompletionTime.list, params, this.oaMoldflowCompletionTimeTable)
          this.requestSubTableData(this.url.oaMoldDesignCompletionTime.list, params, this.oaMoldDesignCompletionTimeTable)
          this.requestSubTableData(this.url.oaMoldProcessingCompletionTime.list, params, this.oaMoldProcessingCompletionTimeTable)
          this.requestSubTableData(this.url.oaProjectObjectiveManagement.list, params, this.oaProjectObjectiveManagementTable)
          this.requestSubTableData(this.url.oaOrderTime.list, params, this.oaOrderTimeTable)
          this.requestSubTableData(this.url.oaMoldTestAndRepairManagement.list, params, this.oaMoldTestAndRepairManagementTable)
          this.requestSubTableData(this.url.oaProjectChangeManagement.list, params, this.oaProjectChangeManagementTable)
          this.requestSubTableData(this.url.oaProjectAcceptanceManagement.list, params, this.oaProjectAcceptanceManagementTable)
        }
      },
      //校验所有一对一子表表单
      validateSubForm(allValues){
          return new Promise((resolve,reject)=>{
            Promise.all([
            ]).then(() => {
              resolve(allValues)
            }).catch(e => {
              if (e.error === VALIDATE_NO_PASSED) {
                // 如果有未通过表单验证的子表，就自动跳转到它所在的tab
                this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
              } else {
                console.error(e)
              }
            })
          })
      },
      /** 整理成formData */
      classifyIntoFormData(allValues) {
        let main = Object.assign(this.model, allValues.formValue)
        return {
          ...main, // 展开
          oaDfmCompletionTimeList: allValues.tablesValue[0].values,
          oaMoldflowCompletionTimeList: allValues.tablesValue[1].values,
          oaMoldDesignCompletionTimeList: allValues.tablesValue[2].values,
          oaMoldProcessingCompletionTimeList: allValues.tablesValue[3].values,
          oaProjectObjectiveManagementList: allValues.tablesValue[4].values,
          oaOrderTimeList: allValues.tablesValue[5].values,
          oaMoldTestAndRepairManagementList: allValues.tablesValue[6].values,
          oaProjectChangeManagementList: allValues.tablesValue[7].values,
          oaProjectAcceptanceManagementList: allValues.tablesValue[8].values,
        }
      },
      validateError(msg){
        this.$message.error(msg)
      },

    }
  }
</script>

<style scoped>
</style>